using System;
using System.Collections.Generic;
using Windy.Transformations;
using System.ComponentModel.Composition;

namespace Windy.DragonCurve.Models.Schemes
{
    /// <summary>
    /// Terdragon
    ///
    /// angle 120°
    /// initial string F
    /// string rewriting rules
    /// F : F+F-F.
    /// </summary>
    [Export(typeof(DragonCurveScheme))]
    public class TerdragonScheme : DragonCurveScheme
    {
        public TerdragonScheme()
        {
            this.SetupName("Terdragon")
                .SetupInitialSymbols(Symbols.F)
                .SetupCurveRules
                (
                    new ReplaceTransformRule<Symbols, LinkedListNode<Symbols>, Symbols>(Symbols.Plus, Symbols.Plus),
                    new ReplaceTransformRule<Symbols, LinkedListNode<Symbols>, Symbols>(Symbols.Minus, Symbols.Minus),

                    new ExpandTransformRule<Symbols, LinkedListNode<Symbols>, Symbols>(Symbols.F,
                            Symbols.F, Symbols.Plus, Symbols.F, Symbols.Minus, Symbols.F)
                )
                .SetupPlotRules(DragonCurvePlotRules.PlotingVariablePlotingRules)
                .SetupStepAngelDegree(120);
        }
    }
}
